#include <iostream>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    long long pieces[10001] = {0};
    int i, n;
    pieces[1] = 2;
    pieces[2] = 7;
    for (i = 3; i < 10001; i++)
    {
        pieces[i] = pieces[i - 1] + 2 * (2 * (i - 1) + 1) - 1;
    }
    cin >> n;
    while (n--)
    {
        cin >> i;
        cout << pieces[i] << endl;
    }
    return 0;
}